home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tptc17tc.zip / POINTERS.PAS < prev    next >
Pascal/Delphi Source File  |  1988-03-25  |  478b  |  28 lines

  1. (*
  2.  * Examples of pointer manipulation
  3.  *
  4.  *)
  5.  
  6. program Pointer_Use_Example;
  7.  
  8. type 
  9.     Name  = string[20];
  10.  
  11. var  
  12.     My_Name : ^Name; (* My_Name is a pointer to a string[20] *)
  13.     My_Age  : ^integer;  (* My_Age is a pointer to an integer *)
  14.  
  15. begin
  16.    New(My_Name);
  17.    New(My_Age);
  18.  
  19.    My_Name^ := 'John Q Doe';
  20.    My_Age^ := 27;
  21.  
  22.    Writeln('My name is ',My_Name^);
  23.    Writeln('My age is ',My_Age^:3);
  24.  
  25.    Dispose(My_Name);
  26.    Dispose(My_Age);
  27. end.
  28.